package com.baitiaojun.video.handler.canal.view;

import com.baitiaojun.api.domain.video.VideoView;
import com.baitiaojun.video.handler.canal.SyncEsHandler;
import lombok.SneakyThrows;
import org.springframework.stereotype.Component;
import top.javatool.canal.client.annotation.CanalTable;
import top.javatool.canal.client.handler.EntryHandler;

/**
 * @类名 ViewCountSyncEsHandler
 * @描述 TODO
 * @作者 白条君
 * @创建日期 2023/1/25 01:46
 * @版本 1.0
 */
@Component
@CanalTable("t_video_view")
public class ViewCountSyncEsHandler extends SyncEsHandler implements EntryHandler<VideoView> {

    @SneakyThrows
    @Override
    public void insert(VideoView videoView) {
        Long videoId = videoView.getVideoId();
        super.updateVideo(videoId);
    }

    @SneakyThrows
    @Override
    public void delete(VideoView videoView) {
        Long videoId = videoView.getVideoId();
        super.updateVideo(videoId);
    }
}
